<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>花海脚手架 - 修改器</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layui/css/layui.css" media="all">
</head>
<body>

<ul class="layui-nav" lay-bar="disabled">
    <div class="layui-container">
        <li class="layui-nav-item">
            <a href="#">花海脚手架</a>
        </li>
        <li class="layui-nav-item layui-this">
            <a href="#">修改器</a>
        </li>
        <li class="layui-nav-item">
            <a href="http://www.tellsea.cn/" target="_blank">在线文档</a>
        </li>
    </div>
</ul>
<div class="layui-container">

    <div class="layui-bg-gray">
        <div class="layui-panel" style="padding: 30px;">
            <form class="layui-form" action="" lay-filter="dataForm">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>修改前</legend>
                        </fieldset>
                    </div>
                    <div class="layui-col-md6">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>修改后</legend>
                        </fieldset>
                    </div>
                    <div class="layui-col-md6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目根目录</label>
                            <div class="layui-input-block">
                                <input type="text" name="rootPath" lay-verify="rootPath" placeholder="项目根目录"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">后端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="systemName" lay-verify="systemName" placeholder="请输入后端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">PC端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="pcName" lay-verify="systemName" placeholder="请输入PC端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="userName" lay-verify="userName" placeholder="请输入用户端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">组织名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="orgName" lay-verify="orgName" placeholder="请输入组织名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">模块名前缀</label>
                            <div class="layui-input-block">
                                <input type="text" name="modelPrefix" lay-verify="modelPrefix" placeholder="请输入模块名前缀"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">目标根目录</label>
                            <div class="layui-input-block">
                                <input type="text" name="rootPathTarget" lay-verify="rootPathTarget" placeholder="目标根目录"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">后端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="systemNameTarget" lay-verify="systemNameTarget"
                                       placeholder="请输入后端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">PC端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="pcNameTarget" lay-verify="systemNameTarget"
                                       placeholder="请输入PC端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户端名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="userNameTarget" lay-verify="userNameTarget"
                                       placeholder="请输入用户端名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">组织名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="orgNameTarget" lay-verify="orgNameTarget" placeholder="请输入组织名称"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">模块名前缀</label>
                            <div class="layui-input-block">
                                <input type="text" name="modelPrefixTarget" lay-verify="modelPrefixTarget"
                                       placeholder="请输入模块名前缀"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md12">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>文件夹/文件配置</legend>
                        </fieldset>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">删除目录</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="deleteFolderList[]" value=".git" lay-skin="primary" title=".git"
                                       checked="">
                                <input type="checkbox" name="deleteFolderList[]" value=".idea" lay-skin="primary" title=".idea"
                                       checked="">
                                <input type="checkbox" name="deleteFolderList[]" value="log" lay-skin="primary" title="logs"
                                       checked="">
                                <input type="checkbox" name="deleteFolderList[]" value="target" lay-skin="primary" title="target"
                                       checked="">
                                <input type="checkbox" name="deleteFolderList[]" value="node_modules" lay-skin="primary" title="node_modules"
                                       checked="">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">删除文件</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="deleteFileList[]" value="LICENSE" lay-skin="primary" title="LICENSE"
                                       checked="">
                                <input type="checkbox" name="deleteFileList[]" value="README.md" lay-skin="primary"
                                       title="README.md">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">排除不替换</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="excludeFileSuffix[]" value=".jar" lay-skin="primary" title=".jar"
                                       checked="">
                                <input type="checkbox" name="excludeFileSuffix[]" value=".pdm" lay-skin="primary" title=".pdm"
                                       checked="">
                                <input type="checkbox" name="excludeFileSuffix[]" value=".pdb" lay-skin="primary" title=".pdb"
                                       checked="">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" style="text-align: center;">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="submitForm">开始修改</button>
                        <button type="reset" class="layui-btn layui-btn-primary">清空表单</button>
                    </div>

                    <div class="layui-col-md12">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>修改结果</legend>
                        </fieldset>
                        <div id="resultDom" style="padding: 20px; line-height: 25px;"></div>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>
<script src="<%=request.getContextPath()%>/static/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'layedit', 'laydate', 'jquery'], function () {
        let form = layui.form
            , $ = layui.jquery
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //表单赋值
        form.val('dataForm', {
            "rootPath": "D:\\Workspace\\TemplateWorkspace\\project-system"
            , "systemName": "project-service"
            , "pcName": "project-web"
            , "userName": "project-uview"
            , "orgName": "ruoyi"
            , "modelPrefix": "ruoyi"

            , "rootPathTarget": "D:\\Workspace\\HzyfWorkspace\\system-school-2"
            , "systemNameTarget": "hzyf-school-service"
            , "pcNameTarget": "hzyf-school-web"
            , "userNameTarget": "hzyf-school-user"
            , "orgNameTarget": "hzyf"
            , "modelPrefixTarget": "model"
        });

        //监听提交
        form.on('submit(submitForm)', function (data) {
            $('#resultDom').empty();
            var index = layer.load();
            $.ajax({
                url: "<%=request.getContextPath()%>/handle",
                type: "POST",
                data: data.field,
                success: function (res) {
                    layer.msg(res.msg, {icon: 1});
                    $('#resultDom').append(res.data);
                    $(document).scrollTop($(document).height() - $(window).height());
                    layer.close(index);
                }
            });
            return false;
        });
    });
</script>

</body>
</html>

